home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / AMIGA / AMICUS / AMICUS05.ADF / menudemo / rmenu.c < prev    next >
C/C++ Source or Header  |  1986-01-15  |  3KB  |  112 lines

  1.  
  2. /* rmenu.c      from AmigaLink 1/25/86 */
  3.  
  4. #include "standard.h"
  5.  
  6. #define MENUPROJECT 0
  7. #define MENUEDIT 1
  8. #define MENUSTYLES 2
  9. #define MENUCOLORS 3
  10.  
  11. #define BLUE 0
  12. #define WHITE 1
  13. #define BLACK 2
  14. #define RED 3
  15.  
  16. extern ULONG *GfxBase;
  17. extern ULONG *IntuitionBase;
  18. extern ULONG *DosBase;
  19. extern ULONG *DiskfontBase;
  20.  
  21. extern struct MsgPort consoleMsgPort;
  22. extern struct Menu *menus;
  23. extern struct MenuItem styleitems[];
  24.  
  25.  
  26. extern struct Window *OpenWindow();
  27. extern struct Window *window;
  28. extern struct IntuiMessage *message;
  29.  
  30. extern char *filebuffer;
  31. extern char *filename;
  32.  
  33. closewindow(msg,w)
  34. struct IntuiMessage *msg;
  35. struct Window *w;
  36. {
  37. ReplyMsg(msg);
  38. CDClose();      /* close the console */
  39. ClearMenuStrip(w);
  40. CloseWindow(w);
  41.  
  42. CloseLibrary(GfxBase);
  43. CloseLibrary(IntuitionBase);
  44. CloseLibrary(DosBase);
  45.  
  46. OpenWorkBench(); /* just in case */
  47. exit(0);
  48. }
  49.  
  50. MenuPick(message,window)
  51. struct IntuiMessage *message;
  52. struct Window *window;
  53. {
  54. ULONG ThisOne,NextOne;
  55. ULONG  choice;
  56.  
  57. NextOne = message->Code;
  58. do {
  59.      ThisOne=NextOne;
  60.         if((MENUNUM(ThisOne))==MENUSTYLES) {
  61.             choice=ITEMNUM(ThisOne);
  62.  
  63.          if( (styleitems[choice].Flags&CHECKED)==CHECKED )
  64.           CDPutStr("Processed a style\r\n");
  65.  
  66.          NextOne=((struct MenuItem *)
  67.           ItemAddress(&menus,ThisOne))->NextSelect;
  68.             if (NextOne==MENUNULL)CDPutStr("processed all styles\r\n");
  69.      }
  70.  
  71.      else if ((MENUNUM(ThisOne))==MENUCOLORS) {
  72.          if(ITEMNUM(ThisOne)==0)SetBPen(window->RPort,SUBNUM(ThisOne));
  73.          else SetAPen(window->RPort,SUBNUM(ThisOne));
  74.  
  75.          NextOne=((struct MenuItem *)
  76.           ItemAddress(&menus,ThisOne))->NextSelect;
  77.      }
  78.  
  79.         else if ((MENUNUM(ThisOne))==MENUPROJECT) {
  80.         NextOne= MENUNULL;
  81.         switch(ITEMNUM(ThisOne)) {
  82.            case 0: /* new */
  83.                 CDPutStr("clear all\r\n");
  84.                 break;
  85.            case 1: /* load */
  86.           CDPutStr("load a file\r\n");
  87.                 break;
  88.            case 2: /* save */
  89.           CDPutStr("save a file\r\n");
  90.                 break;
  91.            case 3: /* save as */
  92.           CDPutStr("save a file as\r\n");
  93.                 break;
  94.            case 4: /* print */
  95.           CDPutStr("print a file\r\n");
  96.                 break;
  97.            case 5: /* print as */
  98.           CDPutStr("print a file as\r\n");
  99.                 break;
  100.            case 6: /* quit */
  101.                 closewindow(message,window);
  102.                 break;
  103.            default:
  104.      }}
  105.  
  106.      else NextOne=MENUNULL; /* unknown menu message */
  107.  
  108. } while (NextOne != MENUNULL);
  109. return(0);
  110. }
  111.  
  112.